﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AsyncUnitTest
{
    public class MyTest4
    {
        public static void Go()
        {
            Show().Wait();
        }

        public static async Task Show()
        {
            string fileName = "1.txt";
            string txt1 = await GetFileTxt_1(fileName);
            string txt2 = await GetFileTxt_2(fileName);
            string txt3 = await GetFileTxt_3(fileName);
        }

        public async static Task<string> GetFileTxt_1(string fileName)
        {
            string path = "e://TxtFiles/";
            return await File.ReadAllTextAsync(path + fileName);
        }

        public static Task<string> GetFileTxt_2(string fileName)
        {
            string path = "e://TxtFiles/";
            return File.ReadAllTextAsync(path + fileName);
        }

        public async static Task<string> GetFileTxt_3(string fileName)
        {
            string path = "e://TxtFiles/";
            var txt = await File.ReadAllTextAsync(path + fileName);
            Console.WriteLine(txt);
            return txt;
        }
    }
}
